<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    ul {
      width: 300px;
      height: 300px;
      display: flex;
      background: palevioletred;
      flex-direction: column;
      justify-content: space-around;
      display: none;
      position: absolute;
    }

    ul li {
      list-style: none;
      line-height: 80px;
      width: 250px;
      text-align: center;
      font-size: 40px;
      cursor: pointer;
      margin: 0 auto;
      background: olivedrab;
    }
  </style>
</head>

<body>
  <ul id="nav">
    <li>充值</li>
    <li>砸钱</li>
    <li>退费</li>
  </ul>
  <script>
    var nav = document.getElementById("nav");
    document.oncontextmenu = function (e) {//oncontextmenu 鼠标右键事件
      var e = e || window.event;
      // 菜单的定位位置  等于鼠标的出现位置
      nav.style.display = "flex";
      nav.style.left = e.clientX + "px";
      nav.style.top = e.clientY + "px";
      return false
    }

  </script>
</body>

</html>